using System;
using System.Collections;
using System.Collections.Generic;

namespace LightCAD.Three
{
    public class Cylindrical
    {
        #region Properties

        public double radius;
        public double theta;
        public double y;

        #endregion

        #region constructor
        public Cylindrical(double radius = 1, double theta = 0, double y = 0)
        {
            this.radius = radius; // distance from the origin to a point in the x-z plane
            this.theta = theta; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
            this.y = y; // height above the x-z plane
        }
        #endregion

        #region methods
        public Cylindrical set(double radius, double theta, double y)
        {
            this.radius = radius;
            this.theta = theta;
            this.y = y;
            return this;
        }
        public Cylindrical copy(Cylindrical other)
        {
            this.radius = other.radius;
            this.theta = other.theta;
            this.y = other.y;
            return this;
        }
        public Cylindrical setFromVector3(Vector3 v)
        {
            return this.setFromCartesianCoords(v.x, v.y, v.z);
        }
        public Cylindrical setFromCartesianCoords(double x, double y, double z)
        {
            this.radius = JMath.sqrt(x * x + z * z);
            this.theta = JMath.atan2(x, z);
            this.y = y;
            return this;
        }
        public Cylindrical clone()
        {
            return new Cylindrical().copy(this);
        }
        #endregion

    }
}
